﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using AMG.DALProfile;
using AMG.DALSQLServer;

namespace AMG.Web
{
    public partial class main : AMG.Web.UI.Page.UserPage
    {
        public int total = 0;
        public int book = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                AMG_Proxy ap = new AMG_Proxy();
                AMG.Model.AMG_Proxy apinfo = new AMG.Model.AMG_Proxy();
                apinfo = ap.GetModel(UserID);
                total = Convert.ToInt16(apinfo.BookNo);
                SqlParameter para=new SqlParameter ("@UserID",UserID);
                book = int.Parse(DbHelper.ExecuteScalar(CommandType.Text, "select count(*) from AMG_UserInfo where CustomerProperty=1 and CompanyID=@UserID", para).ToString());
                bind();
                DataBind();
            }
        }

        private void bind()
        { 
            SqlParameter para=new SqlParameter ("@UserID",UserID);
            DataTable dt = DbHelper.ExecuteTable(CommandType.Text, "SELECT AMGCode, UserName, CASE Sex WHEN 0 THEN '男' ELSE '女' END AS Sex, Phone, ID FROM AMG_UserInfo where CompanyID=@UserID", para);
            DataList1.DataSource = dt;
            DataList1.DataBind();
        }
    }
}
